<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    function getData(url){
        return new Promise((resolve,reject) => {
            const xhr = new XMLHttpRequest()
            xhr.open('GET',url,false)
            xhr.onreadystatechange = () => {
                if(xhr.readyState !== 4) return
                if(xhr.status === 200){
                    resolve(xhr.responseText)
                } else {
                    reject(new Error(xhr.responseText))
                }
            }
            xhr.send()
        })
    }
    getData('./data/a.json').then(res=>{
        console.log(res)
    })
</script>
</html>